﻿using B.S.Warehouse.Domain;
using B.S.Warehouse.ErrorCord;
using B.S.Warehouse.Read.Api.Application.Command.OutboundCommand;
using B.S.Warehouse.Read.Api.Application.Command.OutboundDetailsCommand;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;

namespace B.S.Warehouse.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class OutboundController : ControllerBase
    {
        private readonly IMediator mediator;
        private readonly ISqlSugarClient db;
        public OutboundController(IMediator mediator, ISqlSugarClient db)
        {
            this.mediator = mediator;
            this.db = db;
        }
        /// <summary>
        /// 出库申请显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<ApiPaging<Outbounds>>> GetOutbound([FromQuery] GetOutboundCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 出库申请反填
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<Outbounds>>> FTOutbound([FromQuery] FTOutboundCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 出库申请明细反填
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<List<OutboundDetailss>>> FTOutboundDetails([FromQuery] FTOutboundDetailsCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
